
package com.thinkgem.jeesite.common.component.redis.element;

import redis.clients.jedis.Jedis;

/** 
 * 放置rds的持久化类元素操作
 *
 */
public class RdsPersist {

	public RdsPersist(Jedis jedis) {
	    super();
	    this.jedis = jedis;
    }

	public Jedis getJedis() {
    	return jedis;
    }

	public void setJedis(Jedis jedis) {
    	this.jedis = jedis;
    }

	/**
	 * 同步保存数据到磁盘,返回执行结果
	 * 
	 * 2014-10-27
	 */
	public String save() {
		return getJedis().save();
	}

	/**
	 * 异步保存数据到磁盘,返回执行结果
	 * 
	 * 2014-10-27
	 */
	public String bgsave() {
		return getJedis().bgsave();
	}

	/**
	 * 返回上次成功保存数据到磁盘的操作时间
	 * @return
	 * 2014-10-27
	 */
	public Long lastsave() {
		return getJedis().lastsave();
	}

	/**
	 * 同步保存到服务器,并关闭服务器
	 * @return
	 * 2014-10-27
	 */
	public String shutdown() {
		return getJedis().shutdown();
	}

	/**
	 * 当日志文件过长时重写日志文件
	 * @return
	 * 2014-10-27
	 */
	public String bgrewriteaof() {
		return getJedis().bgrewriteaof();
	}

	private Jedis jedis;//当前客户端
}
